/*******************************************************************************
*@file		:	main.h															
*@brief    :	main head file													
*@author  : mcu
*@version : Ver 1.1
*@data	  : 2018-03-23
*@note	  : Copyright(c) 2018 JJI. All rights reserved.
***********************************************************************************/

#ifndef _MAIN_H_ 
#define _MAIN_H_

#include "types.h"


typedef enum{
	SysEvent_Null = 0,

	// sysboot �¼�����
	SysEvent_Reset,			// ϵͳ��λ�� ����
	SysEvent_PowOn,			// CPU���Ѻ󣬴���
	SysEvent_PowDown,			// CPUֹͣǰ������
	
	SysEvent_ACC,				// ACC�б仯ʱ ����
	SysEvent_ChangePowState,	// powstate״̬�仯ʱ ����

	SysEvent_VedioStateChange,	// ��Ƶ���״̬�仯ʱ ����
	
	SysEvent_Max
}SysEvent_Type_Define;


typedef union{
	uint8_t acc_on;	// ��ǰ��acc״̬
	uint8_t * pdata;
}SysEvent_Param_Define;

typedef struct
{
	SysEvent_Type_Define type;
	SysEvent_Param_Define param;
}SysEvent_Define;

typedef enum{
	SysMode_Reset,
	SysMode_Init,
	SysMode_PowerOn,
	SysMode_Working,
	SysMode_PrepareSleep,
    SysMode_Sleep,
	SysMode_Max
}SysMode_t;

typedef struct{
    uint16_t T1ms;
    uint16_t T10ms;
    uint16_t T20ms;
    uint16_t T50ms;
    uint16_t T100ms;
    uint16_t T1s;
    uint8_t T1msflag;
    uint8_t T10msflag;
    uint8_t T20msflag;
    uint8_t T50msflag;
    uint8_t T100msflag;
    uint8_t T1sflag;
}Timer_t;

typedef union{
	uint8_t data[4];
	uint32_t flag;
}Sys_FlashFlag_u;
typedef struct{
    SysMode_t mode;
    Timer_t   time;

	Sys_FlashFlag_u new_appflag;
	Sys_FlashFlag_u compareFlag;
	Sys_FlashFlag_u wdog_resetcnt;
}Sys_t;


extern Sys_t sys;
#endif

